# Contributor: Leo <thinkabit.ukim@gmail.com>
maintainer="Matthias Ahouansou <matthias@ahouansou.cz>"
pkgname=intel-gmmlib
pkgver=22.5.3
pkgrel=0
pkgdesc="Intel Graphics Memory Management Library"
options="!check" # tests can't run in check(), only on install
url="https://github.com/intel/gmmlib/"
arch="aarch64 x86_64"
license="MIT"
makedepends="cmake samurai"
subpackages="$pkgname-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/intel/gmmlib/archive/intel-gmmlib-$pkgver.tar.gz"
builddir="$srcdir/gmmlib-intel-gmmlib-$pkgver"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=Release \
		-DRUN_TEST_SUITE=OFF \
		$CMAKE_CROSSOPTS
	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
6649f241096b3b81a63c7d29b42494f5621dd9988f2570eaeb7164a4e5a71083180d4a8634782c4831ab8cd22e6b736a2e45e1a52cd5b70f62fe892411362444  intel-gmmlib-22.5.3.tar.gz
"
